/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Reportes;

import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import java.io.IOException;

/**
 *
 * @author rfarias
 */
public class FormatosPDF {
    Font normal = FontFactory.getFont("Arial", 10);
    Font negrita = FontFactory.getFont("Arial", 10, Font.BOLD);
    Font subrayado = FontFactory.getFont("Arial", 10, Font.UNDERLINE);
    Font titulo = FontFactory.getFont("Arial", 16, Font.BOLD);
    Font subtitulo = FontFactory.getFont("Arial", 14, Font.BOLD);
    Font descripcion = FontFactory.getFont("Arial", 10, Font.ITALIC);
    
Document document = new Document(); 

public Image addHeader() throws IOException, BadElementException
    {
        Image image = Image.getInstance ("src\\Reportes\\encabezado_varios.jpg");
        image.scalePercent(60f);
        image.setAlignment(Element.ALIGN_CENTER);
        image.setSpacingAfter(5f);
        return image;
    }

public Element addParrafo(String p) throws BadElementException
    {
        Paragraph parrafo = new Paragraph(p,normal);
        return parrafo;
    }

public Element addTitulo(String p) throws BadElementException
    {
        Paragraph parrafo = new Paragraph(p,titulo);
        parrafo.setAlignment(Element.ALIGN_CENTER);
        parrafo.setSpacingAfter(40f);
        return parrafo;
    }

public Element addSubTitulo(String p) throws BadElementException
    {
        Paragraph parrafo = new Paragraph(p,subtitulo);
        parrafo.setAlignment(Element.ALIGN_CENTER);
        parrafo.setSpacingAfter(20f);
        return parrafo;
    }

public PdfPCell addCellHead (String p)
    {
        Font f = negrita;
        f.setColor(BaseColor.WHITE);
        PdfPCell cell = new PdfPCell(new Phrase(p, f));
        cell.setBackgroundColor(BaseColor.BLACK);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setPadding(5);
        return cell;
    }

public PdfPCell addCell (String p)
    {
        Font f = normal;
        PdfPCell cell = new PdfPCell(new Phrase(p, f));
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setPadding(5);
        return cell;
    }
}
